//
//  MotionDetectionViewController.h
//  Seizure
//
//
// UIAccelerometerDelegate is for motion detection for devices lower than 5.0
//
// This Controller handles creating and stopping the Detection, and adjusting senstivity

#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import "SlideToCancelController.h"
#import "DetectorUpdates.h"

@class GraphView;
@class PatientTabViewController;
@class SeizureDetector;
@class NotificationSender;

@interface MotionDetectionViewController : UIViewController <SlideToCancelDelegate, UIAccelerometerDelegate, DetectorUpdates> {
    //Main Motion Detection View Items
    GraphView *graphView;
    UIButton *brightnessButton;
    UILabel *sensitivityLabel;
    UISlider *sensitivitySlider;
    UIButton *startButton;
    UIButton *stopButton;
    UITextView *locationHint;
    
    //Seizure Detected View Items
    SlideToCancelViewController *slideToCancel;
    UIView *alertPrompt;
    UILabel *alertSeconds;
    UITextView *alertText;
    
    //Not seen in view
    PatientTabViewController *parent;
    SeizureDetector *seizureDetector;
    AVAudioPlayer *audioPlayer;
    NotificationSender *locationSender;
}

//Main Motion Detection View Items
@property (nonatomic, retain) IBOutlet GraphView *graphView;
@property (nonatomic, retain) IBOutlet UIButton *brightnessButton;
@property (nonatomic, retain) IBOutlet UILabel *sensitivityLabel;
@property (nonatomic, retain) IBOutlet UISlider *sensitivitySlider;
@property (nonatomic, retain) IBOutlet UIButton *startButton;
@property (nonatomic, retain) IBOutlet UIButton *stopButton;
@property (nonatomic, retain) IBOutlet UITextView *locationHint;

//Seizure Detected View Items
@property (nonatomic, retain) SlideToCancelViewController *slideToCancel;
@property (nonatomic, retain) IBOutlet UIView *alertPrompt;
@property (nonatomic, retain) IBOutlet UILabel *alertSeconds;
@property (retain)            IBOutlet UITextView *alertText;

//Not seen in view
@property (nonatomic, retain) PatientTabViewController *parent;
@property (nonatomic, retain) SeizureDetector *seizureDetector;
@property (nonatomic, retain) AVAudioPlayer *audioPlayer;
@property (nonatomic, retain) NotificationSender *locationSender;

//METHOD DECLARATIONS
- (void)updateLocationHint;
- (void)disableInterface:(BOOL)disable;
//Seizure Alert methods
- (void)startCounter;
- (void)updateAlertCountdown:(int)seconds;
- (void)waitForResponse;
//Accelerometer/Seizure Detection methods
- (IBAction)startGettingData:(id)sender;
- (IBAction)stopGettingData:(id)sender;
- (IBAction)changeBrightness:(id)sender;
//SlideToCancel methods
- (void)cancelled;
- (IBAction)sensitivityHasChanged:(UISlider *)slider;

+ (void)defaultUserBrightness;
@end